package com.ibm.ops.domain.report;

import com.ibm.ops.OpstoolConstant;
import com.ibm.ops.domain.OpsLogMetaDataType;
import com.ibm.ops.domain.metadata.OpsAuditLogFODSRejectReportMetaData;
import com.ibm.ops.domain.metadata.OpsAuditLogReportMetaData;

public class OpsAuditLogFODSRejectReport extends OpsAuditLogReport {
 
	@Override
	protected OpsAuditLogReportMetaData constructOpsAuditLogReportMetaData(String metaData) {
		OpsAuditLogFODSRejectReportMetaData fodsrejectMetaData = new OpsAuditLogFODSRejectReportMetaData();
		fodsrejectMetaData.setType(OpsLogMetaDataType.FODS_REJECT);
		fodsrejectMetaData.setSap_docnum(this.retrieveData(metaData,OpstoolConstant.FODS_REJECT_REPORT_SAP_DOC_NUM_START_IX,OpstoolConstant.FODS_REJECT_REPORT_SAP_DOC_NUM_START_IX + OpstoolConstant.FODS_REJECT_REPORT_SAP_DOC_NUM_LENGTH));
		fodsrejectMetaData.setStatus(this.retrieveData(metaData,OpstoolConstant.FODS_REJECT_REPORT_STATUS_START_IX,OpstoolConstant.FODS_REJECT_REPORT_STATUS_START_IX + OpstoolConstant.FODS_REJECT_REPORT_STATUS_LENGTH));
		fodsrejectMetaData.setIdoc_number(this.retrieveData(metaData,OpstoolConstant.FODS_REJECT_REPORT_IDOC_NUMBER_START_IX,OpstoolConstant.FODS_REJECT_REPORT_IDOC_NUMBER_START_IX + OpstoolConstant.FODS_REJECT_REPORT_IDOC_NUMBER_LENGTH));
		fodsrejectMetaData.setGeo_key(this.retrieveData(metaData,OpstoolConstant.FODS_REJECT_REPORT_GEO_KEY_START_IX,OpstoolConstant.FODS_REJECT_REPORT_GEO_KEY_START_IX + OpstoolConstant.FODS_REJECT_REPORT_GEO_KEY_LENGTH));
		fodsrejectMetaData.setMestype(this.retrieveData(metaData,OpstoolConstant.FODS_REJECT_REPORT_MESTYPE_START_IX,OpstoolConstant.FODS_REJECT_REPORT_MESTYPE_START_IX + OpstoolConstant.FODS_REJECT_REPORT_MESTYPE_LENGTH));
		fodsrejectMetaData.setSerial_number(this.retrieveData(metaData, OpstoolConstant.FODS_REJECT_REPORT_SERIAL_NUMBER_START_IX, OpstoolConstant.FODS_REJECT_REPORT_SERIAL_NUMBER_START_IX + OpstoolConstant.FODS_REJECT_REPORT_SERIAL_NUMBER_LENGTH));
		fodsrejectMetaData.setSndprn(this.retrieveData(metaData, OpstoolConstant.FODS_REJECT_REPORT_SNDPRN_START_IX, OpstoolConstant.FODS_REJECT_REPORT_SNDPRN_START_IX + OpstoolConstant.FODS_REJECT_REPORT_SNDPRN_LENGTH));
		fodsrejectMetaData.setReturn_code(this.retrieveData(metaData, OpstoolConstant.FODS_REJECT_REPORT_RETURN_CODE_START_IX, OpstoolConstant.FODS_REJECT_REPORT_RETURN_CODE_START_IX + OpstoolConstant.FODS_REJECT_REPORT_RETURN_CODE_LENGTH));
		fodsrejectMetaData.setLogtime_in(this.retrieveData(metaData, OpstoolConstant.FODS_REJECT_REPORT_LOGTIME_IN_START_IX, OpstoolConstant.FODS_REJECT_REPORT_LOGTIME_IN_START_IX + OpstoolConstant.FODS_REJECT_REPORT_LOGTIME_IN_LENGTH));
		this.currentMetaData = fodsrejectMetaData;
		return fodsrejectMetaData;
	}

	@Override
	protected OpsAuditLogReportMetaDataKey retrieveOpsAuditLogReportMetaDataKey(String metaData) {
		String key = null;
		if(this.currentMetaData != null){
			if(this.currentMetaData instanceof OpsAuditLogFODSRejectReportMetaData){
				OpsAuditLogFODSRejectReportMetaData obj = ((OpsAuditLogFODSRejectReportMetaData) this.currentMetaData);
				key = obj.getLogtime_in();
			}			
		}else{
			key = this.retrieveData(metaData, OpstoolConstant.FODS_REJECT_REPORT_LOGTIME_IN_START_IX, OpstoolConstant.FODS_REJECT_REPORT_LOGTIME_IN_START_IX + OpstoolConstant.FODS_REJECT_REPORT_LOGTIME_IN_LENGTH);
		}
		return new OpsAuditLogReportMetaDataKey(key);
	}

}
